package com.cbgolf.oa.adapter;


import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.cbgolf.oa.util.Util;
import java.util.List;

/**
 * @author lq
 * @date 2016/11/17
 */
public class MyFragmentPagerAdapter extends FragmentPagerAdapter {

  private List<Fragment> list;

  public MyFragmentPagerAdapter(FragmentManager fm, List<Fragment> list) {
    super(fm);
    this.list = list;
  }

  @Override
  public Fragment getItem(int position) {
    return (Util.listIsNull(list)) ? null : list.get(position);

  }

  @Override
  public int getCount() {
    return null == list ? 0 : list.size();
  }
}
